package com.threader.bo;

public class PeopleThread extends Thread {

	public People people = null;
	private boolean quit = false;

	public void quit() {
		quit = true;
		if (this.isAlive())
			try {
				join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
	}

	public PeopleThread(People p) {
		people = p;
	}

	public void run() {
		while (people != null && quit == false && people.getTime().isRunning()) {
			people.action();
			try {
				sleep(people.getTime().getDelay());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

}
